OpenRoads Designer CONNECT Edition SDK Help

Print Elevations of Vertical Alignment Stationing

OpenRoads designer does not support to add stationing to the vertical alignment as we can add for horizontal alignment, but as stationing is a set of points along the alignment, we are taking control points of profile here to find its elevation. The below code snippet shows how to calculate the profile's point elevation value.

Example


internal void PrintVerticalAlignmentStationing(Profile profile)
        {
            if (profile == null) return;

            //Get vertical control points of profile, here of type StartEnd_Point
            Bentley.CifNET.LinearGeometry.LinearPointCollection ptsCollection = profile.ProfileGeometry.GetVerticalControlPoints(VerticalControlPointTypes.StartEnd_Point);
            DPoint3d[] points = ptsCollection.GetVertices();

            //Get StationingFormatter and StationFormatSettings, used for formating the values
            StationingFormatter format = new StationingFormatter(profile.Alignment);
            StationFormatSettings settings = StationFormatSettings.GetStationFormatSettingsForModel(Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnModelRef() as DgnModel);

            //For each point from collection, format its station value and calculate elevation
            foreach (DPoint3d point in points)
            {
                //Format the values of X coordinate of point based on settings
                string station = string.Empty;
                format.FormatStation(ref station, point.X, settings);
                //Find point elevation
                string elevation = FormatForDisplay.Distance(point.Y);
                string stationAndElevation = "Station: " + station + " | Elevation: " + elevation;
                System.Diagnostics.Debug.Print(stationAndElevation);
            }
        } 

Call ProfileGeometry.GetVerticalControlPoints() to get control points from profile. Get the coordinates for each point. The Y coordinate of point gives the elevation value of it.

Output

The above function PrintVerticalAlignmentStationing() generates output in below format.

Station: 0+00.00 | Elevation: 164.042'
Station: 26+24.67 | Elevation: 173.884'